<?php
//var_dump();
class DuomaiOrderLog extends BaseModel
{
	public $res;
	public $redis_key="";
	public function getSource()
    {
        return "duomai_order_log";
    }
	public function initialize()
	{
		parent::initialize();
	}




	public function find_by_order_sn($order_sn){
        $user_info = $this->findFirstByOrderSn($order_sn);
        return $user_info;
    }


    /**
     * 多麦订单回调日志
     */
	public function save_params($params){
	    $duomai_obj = $this->findFirstByOrderSn($params['order_sn']);
	    if($duomai_obj){
	        $duomai_obj->status=$params['status'];
	        $duomai_obj->updated_at = date('Y-m-d H:i:s');
	        $duomai_obj->save();
	        return $duomai_obj->save();
        }
        $this->ads_id=$params['ads_id'];
        $this->ads_name=$params['ads_name'];
        $this->site_id=$params['site_id'];
        $this->link_id=$params['link_id'];
        $this->euid=$params['euid'];
        $this->order_sn=$params['order_sn'];
        $this->order_time=$params['order_time'];
        $this->orders_price=$params['orders_price'];
        $this->siter_commission=$params['siter_commission'];
        $this->status=$params['status'];
        $this->checksum=$params['checksum'];
        $this->updated_at = date('Y-m-d H:i:s');
        $this->save();
        if($this->id){
            return $this->id;
        }else{
            return 0;
        }
    }


}
